<?php

namespace app\admin\controller;

use app\admin\logic\DealerAssistanceApplicationLogic;
use support\Request;
use support\Response;

class DealerAssistanceApplicationController extends BaseController
{
    public function __construct()
    {
        $this->logic = new DealerAssistanceApplicationLogic();
    }

    public function index(Request $request): Response
    {
        $where = $request->more([
            ['company_id', ''],
            ['dealer_id', ''],
            ['apply_status', ''],
            ['create_time', []]
        ]);
        $page = $request->input('page', 1);
        $limit = $request->input('limit', 20);
        $list = $this->logic->getDealerAssistanceApplications($where, $page, $limit);
        return $this->success($list);
    }

    public function export(Request $request): Response
    {
        $where = $request->more([
            ['company_id', ''],
            ['dealer_id', ''],
            ['apply_status', ''],
            ['create_time', []]
        ]);
        return $this->logic->export($where);
    }

}